<?php
	require_once("FileUploadHandler.php");
	require_once("FileUploadView.php");
	
	class FileUploadController {
		
		/**
		 * @param boolean $login
		 * @return string HTML
		 */
		public function DoControll($login, $lw) {
			$fuv = new FileUploadView();
			$html = null;
			
			if ($fuv->TriedToUpload()) {
				$errorCode = $this->FileUpload();
				$html .= $lw->ErrorHandler($errorCode);
			}
			
			if ($login) {
				$html .= $fuv->DoFileUploadBox();
			}
			
			$html .= $fuv->DoFileListBox();
			
			return $html;
		}
		
		/**
		 * Call UploadFile(GetFile)
		 * @return string HTML
		 */
		public function FileUpload() {
			$fuh = new FileUploadHandler();
			$fuv = new FileUploadView();
			
			return $fuh->UploadFile($fuv->GetFile());
		}
	}
?>